<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [1, 5, 3, 1, 3, 6, 8, 5, 3]
            // 实例化map
        let map = new Map()
            // 遍历数组
        arr.forEach(item => {
            // 如果map中没有查找到数组的每一项
            if (!map.has(item)) {
                // 把每一项添加到map中
                map.set(item, 0)
            }
        })
        console.log(map);
    </script>
</body>

</html>